<?php
namespace app\system\validate;
use think\Validate;

class WebSet extends Validate
{
    // 验证规则
    protected $rule = [
        ['name', 'require', '-10014'],
        ['token', 'require', '-13002'],
        ['domain','require','-13002'],
        ['account','require','-11412'],
        ['pid','require','-11413'],
        ['key','require','-11414'],
        ['type','require','-11415'],
        ['is_first_login','require','-10044'],
        ['logo', 'require', '-11249'],
        ['descript', 'require', '-11250'],
        //['add', 'check_info'],
        //['update', 'check_info'],
    ];
    protected $scene = [
        'del' => ['id' => 'require', 'set_id' => 'require'],
        'list' => ['set_id' => 'require'],
        'domain' => ['token' => 'require','domain' => 'require'],
        'record' => ['domain' => 'require'],
        'alipay' => ['domain' => 'require','account' => 'require','pid' => 'require','key' => 'require','type' => 'require'],
        'first_login' =>['token','is_first_login'],
        'edit_website' => ['token','name'=>'require','logo','descript'],
    ];

    //验证网站名称是否唯一
    /*protected function checkname($value,$rule,$data){
        if (isset($data['id'])&&$data['id']) $where['id'] = array("neq",$data['id']);
        $where['name'] = $data['name'];
        $where['set_id'] = $data['set_id'];
        return db($this->product)->where($where)->find() ? "-10015" : true ;
    }*/
}